/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package klijent.gui.util;

import domen.Dolazak;
import java.util.LinkedList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Ivan Ivic
 */
public class ModelTabeleDolasci extends AbstractTableModel {
    private LinkedList<Dolazak> listaDolazaka;
    private String[] naziviKolona = {"Datum dolaska"};

    public ModelTabeleDolasci() {
        listaDolazaka = new LinkedList<Dolazak>();
    }

    public ModelTabeleDolasci(LinkedList<Dolazak> listaDolazaka) {
        this.listaDolazaka = listaDolazaka;
    }

    public int getRowCount() {
        return listaDolazaka.size();
    }

    public int getColumnCount() {
        return 1;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Dolazak d = listaDolazaka.get(rowIndex);
        switch (columnIndex)
        {
            case 0:
                return d.getVremeDolaska();
            default:
                return 0;
        }
    }

    @Override
    public String getColumnName(int column) {
        return naziviKolona[column];
    }

}
